$pf-c-description-list--breakpoint-map: build-breakpoint-map("base", "md", "lg", "xl", "2xl");

.pf-c-description-list {
  --pf-c-description-list--RowGap: var(--pf-global--gutter--md);
  --pf-c-description-list--ColumnGap: var(--pf-global--spacer--lg);
  --pf-c-description-list--GridTemplateColumns--count: 1;
  --pf-c-description-list--GridTemplateColumns--width: 1fr;
  --pf-c-description-list--GridTemplateColumns: repeat(var(--pf-c-description-list--GridTemplateColumns--count), var(--pf-c-description-list--GridTemplateColumns--width));

  // Group
  --pf-c-description-list__group--RowGap: var(--pf-global--spacer--sm);
  --pf-c-description-list__group--ColumnGap: var(--pf-global--spacer--md);
  --pf-c-description-list__group--GridTemplateColumns: auto;
  --pf-c-description-list__group--GridColumn: auto;

  // Term
  --pf-c-description-list__term--FontWeight: var(--pf-global--FontWeight--bold);
  --pf-c-description-list__term--FontSize: var(--pf-global--FontSize--sm);

  // Horizontal
  --pf-c-description-list--m-horizontal__term--width: 12ch;
  --pf-c-description-list--m-horizontal__description--width: minmax(10ch, auto);
  --pf-c-description-list--m-horizontal__group--GridTemplateColumns: var(--pf-c-description-list__term--width) var(--pf-c-description-list--m-horizontal__description--width); // use --pf-c-description-list__term--width here as it is re-defined on line 45
  --pf-c-description-list--m-1-col--GridTemplateColumns--count: 1;

  @media screen and (min-width: $pf-global--breakpoint--md) {
    --pf-c-description-list--m-2-col--GridTemplateColumns--count: 2;
    --pf-c-description-list--m-3-col--GridTemplateColumns--count: 3;
  }

  --pf-c-description-list--m-auto-fit--GridTemplateColumns--min: #{pf-size-prem(250px)};
  --pf-c-description-list--m-auto-fit--GridTemplateColumns--minmax--min: var(--pf-c-description-list--m-auto-fit--GridTemplateColumns--min);

  display: grid;
  align-items: baseline;
  row-gap: var(--pf-c-description-list--RowGap);
  column-gap: var(--pf-c-description-list--ColumnGap);
  grid-template-columns: var(--pf-c-description-list--GridTemplateColumns);

  &.pf-m-horizontal {
    --pf-c-description-list__group--GridTemplateColumns: var(--pf-c-description-list--m-horizontal__group--GridTemplateColumns);

    @include pf-build-css-variable-stack("--pf-c-description-list__term--width", "--pf-c-description-list--m-horizontal__term--width", $pf-c-description-list--breakpoint-map);
  }

  &.pf-m-inline-grid {
    display: inline-grid;
  }

  &.pf-m-auto-column-widths {
    --pf-c-description-list--GridTemplateColumns--width: minmax(8ch, max-content);
  }

  &.pf-m-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(var(--pf-c-description-list--m-auto-fit--GridTemplateColumns--minmax--min), 1fr));

    @include pf-build-css-variable-stack("--pf-c-description-list--GridTemplateColumns--minmax--min", "--pf-c-description-list--GridTemplateColumns--min", $pf-c-description-list--breakpoint-map);
  }
}

.pf-c-description-list__group {
  display: grid;
  grid-column: var(--pf-c-description-list__group--GridColumn);
  row-gap: var(--pf-c-description-list__group--RowGap);
  column-gap: var(--pf-c-description-list__group--ColumnGap);
  grid-template-columns: var(--pf-c-description-list__group--GridTemplateColumns);
  align-items: baseline;
}

.pf-c-description-list__term,
.pf-c-description-list__description {
  text-align: left;
}

.pf-c-description-list__term {
  font-size: var(--pf-c-description-list__term--FontSize);
  font-weight: var(--pf-c-description-list__term--FontWeight);

  .pf-c-description-list__text {
    display: inline;
  }
}

// Responsive modifiers
// stylelint-disable no-duplicate-selectors, max-nesting-depth
.pf-c-description-list {
  @each $breakpoint, $breakpoint-value in $pf-c-description-list--breakpoint-map {
    $breakpoint-name: if($breakpoint != "base", -on-#{$breakpoint}, "");

    @include pf-apply-breakpoint($breakpoint, $pf-c-description-list--breakpoint-map) {
      &.pf-m-1-col#{$breakpoint-name} {
        --pf-c-description-list--GridTemplateColumns--count: var(--pf-c-description-list--m-1-col--GridTemplateColumns--count);
      }

      &.pf-m-2-col#{$breakpoint-name} {
        --pf-c-description-list--GridTemplateColumns--count: var(--pf-c-description-list--m-2-col--GridTemplateColumns--count);
      }

      &.pf-m-3-col#{$breakpoint-name} {
        --pf-c-description-list--GridTemplateColumns--count: var(--pf-c-description-list--m-3-col--GridTemplateColumns--count);
      }
    }
  }
}
// stylelint-enable

// .pf-c-description-list.pf-m-horizontal.pf-m-auto-term-widths {
//   @supports (grid-template-columns: subgrid) {
//     --pf-c-description-list--GridTemplateColumns--width: max-content auto;
//     --pf-c-description-list__group--GridTemplateColumns: subgrid;
//     --pf-c-description-list__group--GridColumn: auto / span 2;
//   }
// }
